<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <ul>
            <li>1</li>
            <li>2</li>
            <li>3</li>
            <li>4</li>
            <li>5</li>
        </ul>
    </div>
    <script>
        var ul1 = document.querySelector('ul');
        
        console.log(ul1.children);
        console.log(ul1.firstElementChild);//第一个
        console.log(ul1.lastElementChild);//最后一个
        //老方法
        console.log(ul1.children[0]);//第一个
        console.log(ul1.children[ul1.children.length-1]);//最后一个
    </script>
</body>
</html>